package com.lxg.demo.service.impl;


import com.lxg.demo.service.HelloService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class HelloServiceImpl implements HelloService {
    @Override
    public String greet(String name) {
        boolean flag = isAdmin(name);
        if(!flag){
            return "Hello, " + name + ", try to do it !";
        }
        if("lxg".equals(name)){
            return "Good boy, Welcome to learn ai technology. Come on!";
        }
        return "Hello, " + name + "!";
    }

    @Override
    public boolean isLogin(String status) {
        return "logIn".equals(status);
    }

    @Override
    public boolean login(String name, String pwd) {
        return "name".equals(name) && "pwd".equals(pwd);
    }

    @Override
    public boolean isValidUser(String name) {
        return checkUser(name);

    }

    private boolean checkUser(String name) {
        return !"valid".equals(name);
    }

    private boolean isAdmin(String name) {
        return "admin".equals(name);
    }
}
